<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>下拉框-绝对定位</title>
    <style>
        * {margin: 0; padding: 0;}
        body {
            background-color: gray;
        }

        .container {
            width: 100px;
            height: 30px;
            margin: 0 auto;
            border: 1px solid black;
            background-color: white;
            position: relative;
        }

        .title {
            width: 100px;
            height: 30px;
            border: 1px solid black;
            text-align: center;
            line-height: 30px;
        }
        .content {
            width: 120px;
            border: 1px solid black;
            position: absolute;
            top: 30px;
            left: 0;
            display: none;
            background-color: white;
        }
        .content p:hover {
            background-color: rgb(179, 169, 169);
            color: white;
        }

        .container:hover > .content {
            display: block;
        }

        .box {
            width: 100px;
            height: 100px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="title">
            城市
        </div>
        <div class="content">
            <p>北京</p>
            <p>上海</p>
            <p>天津</p>
            <p>广州</p>
        </div>
        <div class="box"></div>
    </div>
</body>
</html>